This program may not be commercially distributed without my written permission.
Welcome to Backstab. As you play Backstab, you may suspect that you've seen versions of this game before. You're probably right. It's a simple board game, although much harder to play than it first appears. I wrote another version of this game because I felt that it was important to contain features that the other versions lacked. My version has animated graphics, both color and black and white, digitized sound, a scoreboard, and expandability: the ability to add new boards and computer players to this program.
How to Play the Game
The rules are very simple. You are either red or blue (black or white) and your object is to finish the game with more pieces than your opponent.
The board is seven squares across by seven squares tall. A square can either be empty, have a piece in it, or have a barrier. Each turn you can move one piece. It can move up to two squares in any direction, and can jump over other pieces at will. If the piece you move only moves within a one square radius, then the original piece is left behind as well as a new piece appearing in the square you moved to. You get an extra piece this way. If you moved two squares, then the original piece doesn't stay. It's just changes the position of your piece.
All of your opponents pieces in the squares that surround the square you moved into become yours. You can accumulate pieces quickly this way.
It is possible to reach a position where a player has no available moves. In this case, the player loses his or her (or its) turn. Otherwise, passing a turn is not allowed.
The rules are simple, but it’s a hard game to master.
Choosing an Opponent
There are two menus that control who or what is playing the game. If you’re running the game in black and white, the menus are Black and White. If you’re in color, they’re Red and Blue. These menus are identical in content. The first option is Human. If you want the given player to be controlled by a person using the computer, choose this option.
The other items in the menu are computer players. These are the computer players that have been installed into the program (more on that later). The ones I have written myself are: Moronic, Suicidal, Awful, Stupid, Below Average, Average, and Pretty Good.
I suggest playing on Awful at the beginning. Then move up to Stupid, and then to Below Average, and then to Average.
If you’ve never played before, Awful will be a great challenge for a while. If you get tired of being beaten, then you can try switching to Suicidal level. You should be able to overcome this one.
I consider myself a good Backstab player. I win on Average maybe one in four times. I’ve never won on Pretty Good.
Choosing a Board
I suggest playing without a board most of the time, i.e., under the “Standard” option. The game works better that way. Still, I have included different boards to be complete and to give you some variation.
I’ve concocted around fifteen different boards. They start out relatively mundane, but get increasingly strange as you move down the menu. Try ‘em out. The computer players usually don’t play as well with a different board.
Backstab’s Drawbacks, Bugs, and Problems
Options
Most of the options are self-explanatory, but an option named “Fastplay” which resides in the File menu, needs some explanation. Unless you’re making your own computer players (which I’ll get into later on), you probably don’t need this option. What it does is to remove all the effects from the game: sound, animation, and alerts. The result is to play out games as quickly as possible. Also, after a game finishes, another one is immediately begun, without a pause or waiting for user input. The point of this option is to allow computer players to play against each other many times, and then to look at the win totals.
Making your own Boards
This is really easy, assuming you have a resource editor. The boards are stored as resources of type ‘Bord’. Their ID’s don’t have to be numbered consecutively or anything like that. Just add resources and the new boards will appear in the Board menu. It’s as simple as that.
A ‘Bord’ resource consists of a list of indeterminate length of the things which start out on the board. The format for each resource is a list squares, each of which containing the following data:
Occupier: what is in the square, 0 = barrier, 1 = player 1, and 2 = player 2
H-Coordinate: the horizontal position of the square
V-Coordinate: the vertical position of the square
For example, to make a board consisting solely of a barrier piece in the upper right hand corner, your list would be only one item long and would look like this:
Occupier = 0
H-Coordinate = 7
V-Coordinate = 1
As you can see with some of the boards I’ve created, there are no limits as to what boards you can create. Pieces don’t have to start in the traditional corners. All players are not necessarily created equal.
I, Adam Miller, hereby encourage you to make your own boards as you see fit. If you produce any as cool as mine, send ‘em to me.
Me
I encourage correspondence from you. Do you like Backstab? Do you have any suggestions? And please, please, don’t be afraid to write to simply tell me you like this game. It never hurts.
I spent a lot of time writing this game, and it’d be dandy if you’d send me a few bucks if you use it. I would especially like to see any computer players you write. Money’d be better. Nah, I’d prefer players. No, money. Players. Money . . . BOTH (would be nice).
Source code is $15. It’s pretty neat. Written in THINK Pascal. Documented. Lots of interface stuff, plus neat stuff like calling the computer players. Send an initialized disk and a SASE. I can’t send it electronically at this point. The source code is very useful in developing your own computer players, as you can run them from the project and thus have access to runtime debugging from THINK Pascal.
My address is:
Adam Miller
P.O. Box 1156
Yale Station
New Haven, CT 06520
Electronically, it’s:
AMiller@YaleVM.YCC.Yale.edu
Making your own Computer Players
This is the fun stuff. This is what makes my version of this game truly different. It is possible, and, in fact, extremely easy, to write your own computer players. This section is only for programmers, so if you’re simply a user of Backstab, you don’t have to bother to read this. However, it is very easy to write your own players -- you don’t need to be a programming genius to do it.
The way it works is simple: you compile a computer player into a code resource of type ‘PLYR’, and insert this code resource into the resource fork of Backstab, with the resource name set to the name you want your player to have. (Again, the ID doesn’t have to be specially numbered.) Backstab will then automatically insert your computer player into the menu list, and you’re ready to play.
The great thing about writing computer players is that they don’t have to do anything but return a move to Backstab. It’s very easy. I have added this capability to Backstab for all those people out there that always thought it would be neat to write your own computer player, but never wanted to write the game along with it. In Backstab, the game is already written in a good implementation.
Obviously, computer players can be written in any language. My language of choice is THINK Pascal, and this is what I’ve used to write Backstab and the computer players that come with it. I have included sample source files for your convenience, written in THINK Pascal. The ones I have included are the sources of Moronic and Stupid. If someone would send me the C or assembly or whatever code of a player that they have written, that would be great, and I can include it in future versions of Backstab.
I will now give instructions on creating a project in THINK Pascal for compiling computer players. Create a new project. Set the project type to Code Resource, with the resource type to ‘PLYR’ with no attributes. The files in the project should be the Interface.lib, either the DRVRRuntime.lib or the RSRCRuntime.lib, and your pascal source file. It’s then ready to compile.
If you want to include any other resources, that’s fine. The resource fork of Backstab will be current when your computer player is called. None of my own computer players uses resources, but that’s just me.
The parameters passed to the computer file are as follows:
procedure Main (Board: BordType; CurPlayer: integer; var Origin, Move: point);
A variable of BordType is defined thus:
BordType = array[1..7, 1..7] of byte
The Board is the current board in the game. The CurPlayer is either one or two, Red/Black being player one. Origin and Move are the two parameters for the move. Origin is where the move starts, and Move is where the piece moves to.
Make sure that you dispose of all dynamic variables that you use.
Look at the files that I’ve provided as demos. They should help you a lot.
When your computer player is called from Backstab, it gives you a very limited form of debugging: if the computer attempts an illegal move, it tells you, and tells you from where to where it tried to move.
I have written a bunch of computer players, and a couple of them are decent at the game. My methods were basically a multi-ply search. It happens to be very effective in this game. However, my players do suffer numerous short-comings, especially in letting themselves be wiped out at the beginning of the game. There is a lot of room for improvement, and you are the one to do it. Maybe a computer player with strategy, or perhaps one that learns? Send me what you make. See if you can write one that beats Pretty Good.